//
//  JsonParser.m
//  Training
//
//  Created by michael shen on 15/6/17.
//  Copyright (c) 2015年 coolem. All rights reserved.
//

#import "JsonParser.h"
#import "AppDelegate.h"
#import "UserInfo.h"
#import "AreaInfo.h"
#import "ContractInfo.h"
#import "TenantInfo.h"
#import "MenuItem.h"
#import "EquipmentInfo.h"
#import "MerchantContractInfo.h"
#import "CustomerContractInfo.h"
#import "OrgInfo.h"
#import "CustomerInfo.h"
#import "MaintainInfo.h"
#import "AssetInfo.h"
#import "OrgGainInfo.h"
#import "ImageInfo.h"
#import "IncomeInfo.h"
#import "TokenAddressInfo.h"
#import "TokenInfo.h"
#import "TransHistory.h"
#import "AreaMachineInfo.h"
#import "OrgReportInfo.h"
#import "OrgMainReportInfo.h"

@implementation JsonParser
+ (JsonParser *)defaultParser{
    static JsonParser *parser = nil;
    if (parser == nil) {
        parser = [[JsonParser alloc] init];
    }
    return parser;
}

- (NSError *)getResultWithResponseData:(NSData *)responseData{
    if (responseData == nil) {
        return [NSError errorWithDomain:@"" code:0 userInfo:nil];
    }
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    if ([data[@"code"] intValue] == 401) {
        [[FileOperator defaultOperator] deleteUserInfo];
//        [[NSNotificationCenter defaultCenter] postNotificationName:@"ChangeIndex" object:@"mine"];
//        AppDelegate *delegate = [UIApplication sharedApplication].delegate;
//        [delegate initLoginView];
        
        return [NSError errorWithDomain:data[@"msg"] code:401 userInfo:nil];
    }
    NSString *domain = data[@"msg"];
    if (domain == nil||[domain isKindOfClass:[NSNull class]]) {
        domain = @"";
    }
    return [NSError errorWithDomain:domain code:500 userInfo:nil];
}

-(NSDictionary*)getSendSMSResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
    
}



-(NSString*)getLoginResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
        NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSString *string = data[@"response"][@"sid"];
    [[FileOperator defaultOperator] setUserInfoObject:string forKey:@"sid"];
    return string;

}


-(UserInfo*)getUserInfoResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    data = data[@"response"];
    data = [data dictionaryByReplacingNullsWithStrings];
    for (NSString *keyString in [data allKeys]) {
        id va = data[keyString];
//        if (va == nil||[va isKindOfClass:[NSNull class]]) {
//            va = @"";
//        }
        [[FileOperator defaultOperator] setUserInfoObject:va forKey:keyString];
        
    }
    UserInfo *userInfo = [UserInfo yy_modelWithDictionary:data];
    return userInfo;
}

-(NSMutableArray*)getRegionResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        AreaInfo *areaInfo = [AreaInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:areaInfo];
    }
    return mutableArray;
}

-(NSMutableArray*)getContractListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
//    NSArray *array = data[@"response"];
//    if (array.count!=0) {
        for (NSDictionary *dic in data[@"response"][@"list"]) {
            MerchantContractInfo *merchantContractInfo = [MerchantContractInfo yy_modelWithDictionary:dic];
            [mutableArray addObject:merchantContractInfo];
        }
//    }
    return mutableArray;
}

-(NSMutableArray*)getContractListMoreResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        MerchantContractInfo *merchantContractInfo = [MerchantContractInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:merchantContractInfo];
    }
    return mutableArray;
}

-(NSDictionary*)getAddContractResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getModifyContractResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(ContractInfo*)getContractIDResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    ContractInfo *contractInfo = [ContractInfo yy_modelWithDictionary:data[@"response"]];
    return contractInfo;
}

-(NSDictionary*)getContractDeleteResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getTenantListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getAddTenantResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getModifyTenantResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(TenantInfo*)getTenantIDResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    TenantInfo *tenantInfo = [TenantInfo yy_modelWithDictionary:data[@"response"]];

    return tenantInfo;
}

-(NSDictionary*)getTenantDeleteResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSMutableArray*)getUserMenuResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        MenuItem *menuItem = [MenuItem yy_modelWithDictionary:dic];
        [mutableArray addObject:menuItem];
    }
    return mutableArray;
}

-(NSMutableArray*)getEquipmentListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        EquipmentInfo *equipmentInfo = [EquipmentInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:equipmentInfo];
    }
    return mutableArray;
}

-(NSDictionary*)getAddEquipmentResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getModifyEquipmentResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getEquipmentIDResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getEquipmentDeleteResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSMutableArray*)getEquipmentRepairListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        MaintainInfo *maintain = [MaintainInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:maintain];
    }
    return mutableArray;
}

-(NSDictionary*)getAddEquipmentRepairResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSDictionary*)getModifyEquipmentRepairResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
}

-(NSMutableArray*)getEquipmentSimpleListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        EquipmentInfo *equipmentInfo = [EquipmentInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:equipmentInfo];
    }
    return mutableArray;
}

-(NSMutableArray*)getCityHasEQResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        AreaInfo *areaInfo = [AreaInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:areaInfo];
    }
    return mutableArray;
}

-(NSMutableArray*)getCustomerContractListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"][@"list"]) {
        CustomerContractInfo *customerContractInfo = [CustomerContractInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:customerContractInfo];
    }
    return mutableArray;

}

-(NSMutableArray*)getOrgListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"][@"list"]) {
        OrgInfo *orgInfo = [OrgInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:orgInfo];
    }
    return mutableArray;
    
}

-(NSDictionary*)getAddOrgResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];

    return data;
}

-(NSDictionary*)getModifyPassWordResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data;
}

-(NSMutableArray*)getCustomerListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        CustomerInfo *customerInfo = [CustomerInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:customerInfo];
    }
    return mutableArray;
}

-(NSString*)getAllCustomerGainResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];

    return data[@"response"];
}

-(NSDictionary*)deleteOrgResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data;
}

-(NSDictionary*)getConfirmContractResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data;
}

-(NSMutableArray*)getAddEquipmentMaintaintResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data[@"response"];
}

-(NSMutableArray*)getEquipmentRentResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data[@"response"];
}

-(NSDictionary*)getAddCustomerResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data;
}

-(NSMutableArray*)getCustomerDetailResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    if([data[@"response"] allKeys].count>0){
        for (NSDictionary *dic in data[@"response"][@"assetList"]) {
            AssetInfo *assetInfo = [AssetInfo yy_modelWithDictionary:dic];
            [mutableArray addObject:assetInfo];
        
        }
        
        return mutableArray;
        
    }
    
    return mutableArray;
}

-(NSDictionary*)getAddCustomerAssetResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data;
}

-(NSDictionary*)getRedeemAssetResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data;
}

-(NSMutableArray*)getOrgGainListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"][@"txnList"]) {
        OrgGainInfo *orgGainInfo = [OrgGainInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:orgGainInfo];
    }
    return mutableArray;
}

-(NSMutableArray*)getPubInfoResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        ImageInfo *imageInfo = [ImageInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:imageInfo];
    }
    return mutableArray;
}

-(NSMutableArray*)getRemindListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        MerchantContractInfo *merchantContractInfo = [MerchantContractInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:merchantContractInfo];
    }
    return mutableArray;
}

-(NSMutableDictionary*)getProfitMonthlyResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableDictionary *mutableDic = [NSMutableDictionary dictionary];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"][@"monthProfitList"]) {
        IncomeInfo *incomeInfo = [IncomeInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:incomeInfo];
    }
    [mutableDic setObject:mutableArray forKey:@"monthProfitList"];
    [mutableDic setObject:data[@"response"][@"orgAcct"] forKey:@"account"];
    return mutableDic;
}

-(NSDictionary*)getOrgIntoCashResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    return data;
}

-(NSMutableArray*)getTokenListResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        [mutableArray addObject:[TokenAddressInfo yy_modelWithDictionary:dic]];
    }
    return mutableArray;
}

-(NSDictionary*)getAddTokenResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;

}

-(NSDictionary*)getTokenWithDrawResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
    
}

-(TokenInfo*)getSearchTokenResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    TokenInfo *tokenInfo;
    for (NSDictionary *dic in data[@"response"]) {
        tokenInfo = [TokenInfo yy_modelWithDictionary:dic];
    }
    return tokenInfo;
    
}

-(NSMutableArray*)getTransTokenResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for(NSDictionary *dic in data[@"response"]){
        TransHistory *transHistory = [TransHistory yy_modelWithDictionary:dic];
        [mutableArray addObject:transHistory];
    }
    return mutableArray;
    
}

-(NSDictionary*)getChangeTokenStatusResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
    
}

-(NSDictionary*)getCancelDeBlockingResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
    
}

-(NSDictionary*)getLogOutInfoResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data;
    
}

-(NSDictionary*)getContractTotalInfoResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    return data[@"response"];
    
}

-(NSMutableArray*)getAreaMachineReportResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        AreaMachineInfo *areaMachineInfo = [AreaMachineInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:areaMachineInfo];
    }
    return mutableArray;
    
}

-(NSMutableArray*)getOrgReportResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        OrgReportInfo *areaMachineInfo = [OrgReportInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:areaMachineInfo];
    }
    return mutableArray;
    
}

-(NSMutableArray*)getOrgDateReportResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    NSMutableArray *mutableArray = [NSMutableArray array];
    for (NSDictionary *dic in data[@"response"]) {
        OrgMainReportInfo *areaMachineInfo = [OrgMainReportInfo yy_modelWithDictionary:dic];
        [mutableArray addObject:areaMachineInfo];
    }
    return mutableArray;
    
}

-(EquipmentInfo*)getSingleEquipmentDetailResultWithResponseData:(NSData*)responseData{
    if (responseData == nil) return nil;
    NSDictionary *data = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:nil];
    
    EquipmentInfo *equipmentInfo = [EquipmentInfo yy_modelWithDictionary:data[@"response"]];
    return equipmentInfo;
    
}

@end
